package com.sl.plugin.step.selenium.form;

import com.sl.core.engine.meta.impl.AbstractProcessCompDescriptor;
import com.sl.core.engine.step.ProcessCompService;
import com.sl.core.engine.step.impl.AbstractProcessComp;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
/**
 */
public class SeleniumFormComp extends AbstractProcessComp<WebDriver, WebDriver> implements ProcessCompService {

    public SeleniumFormComp(AbstractProcessCompDescriptor abstractProcessCompDescriptor) {
        super(abstractProcessCompDescriptor);
    }

    @Override
    public WebDriver input(WebDriver driver) {
        String keywords = meta.getStrAttr("keywords");
        String cssSelector = meta.getStrAttr("cssSelector");
        driver.findElement(By.cssSelector(cssSelector)).sendKeys(keywords);
        return driver;
    }

}
